package com.anzhen.interview.xml.readData;

import com.alibaba.fastjson.JSON;
import org.apache.commons.io.FileUtils;

import javax.xml.bind.JAXB;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;

/**
 * Created by anzhen on 2017-4-28.
 */
public class ReadAndWrite {

	public static void main(String[] args) throws JAXBException, IOException {
		String xml = FileUtils.readFileToString(new File("Response.xml"), "utf8");
		ResponseDataRoot responseDataRoot = JAXB.unmarshal(new StringReader(xml), ResponseDataRoot.class);
		System.out.println(JSON.toJSONString(responseDataRoot));

	}
}
